      *> File Name     000017_SplitSortJoin.cbl.
      *> Description   String.Split, Array.Sort, String.Join.
      *> Project Type  Console Application.
      *> CodePlex URL  http://cobol.codeplex.com
 
       program-id.   Main.
       repository.
           class split-opts  as "System.StringSplitOptions"
           class sys-console as "System.Console"
           class sys-env     as "System.Environment"
           .
       working-storage section.
       01  delimiters  character  occurs any.
       01  newline     string     value sys-env::"NewLine".
       01  s           string.
       01  strings     string     occurs any.
       procedure division.
           move "String.Split, Array.Sort, String.Join"
               to sys-console::"Title"
 
           move "Split, sort, and join." to s.
           display s newline
 
           set content of delimiters to (",", ".", " ")
           move s::"Split"(delimiters, split-opts::"RemoveEmptyEntries")
               to strings
           invoke string occurs any::"Sort"(strings)
 
           perform varying s through strings
               display s
           end-perform
 
           move string::"Join"(" ", strings) to s
           display newline s newline
 
           display "Press any key to continue . . . "
           invoke sys-console::"ReadKey"(true)
           .
       end program   Main.